<?php
/**
 * Created by PhpStorm.
 * User: JackWang
 * Date: 2022/4/28
 * Time: 10:53
 */
declare(strict_types=1);
use PHPUnit\Framework\TestCase;

/**
 * 同一个测试中组合dataProvider和depends
 * Class DependencyAndDataProviderComboTest
 */
final class DependencyAndDataProviderComboTest extends TestCase
{
    public function provider(): array
    {
        return [['provider1'], ['provider1'],['provider1']];
//        return [['provider1']];
    }

    public function testProducerFirst(): string
    {
        $this->assertTrue(true);

        return 'first';
    }

    public function testProducerSecond(): string
    {
        $this->assertTrue(true);
        return 'second';
    }

    /**
     *
     * @depends testProducerFirst
     * @depends testProducerSecond
     * @dataProvider provider
     */
    public function testConsumer(): void
    {
        //测试失败，这里因为有两个值指向同一个地址。
//        var_dump(func_get_args());die;
        $this->assertSame(['provider1','first','second'],func_get_args());
    }
}